package view.cms.desktop
{

    public class GroupManager 
    {
        private var groups:Array;

        public function GroupManager():void
        {
            groups = new Array();
        }
        
        public function removeGroupFor(obj:DrawingObject):Array
        {
            var g:Array = findGroupFor(obj);
            
            if ( g )
            {
                groups.splice(groups.indexOf(g), 1);
                return g
            };
            return null;
        }
        
        public function findGroupFor(obj:DrawingObject):Array
        {
            var i:int = 0;
            
            while (i < groups.length) 
            {
                if (groups[i].indexOf(obj) > -1)
                {
                    return groups[i];
                };
                
                i++;
            };
            return null;
        }
        
        public function removeGroup(obj:Object):void
        {
            var i:int = groups.indexOf(obj);

            if (i > -1)
            {
                groups.splice(i, 1);
            };
        }
        
        public function addGroup(g:Array):void
        {
            groups.push(g);
        }

    }
}




